package com.glodon.paas.document.web.resource;

import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;

import org.springframework.beans.factory.annotation.Autowired;
import com.glodon.paas.document.service.FileService;
import com.glodon.paas.web.resource.BaseResource;
import com.glodon.paas.web.resource.CommonsResource;

public abstract class DocumentResource extends CommonsResource implements BaseResource {

    @Autowired
    protected FileService fileService;

    @GET
    @Path("/quota")
    @Produces(MediaType.APPLICATION_JSON)
    public long getUsedSpace(@Context
    HttpServletRequest request) {
        return fileService.getUsedSpace(getUserId(request));
    }
}
